# 继承
# 1：父类
class Person:
    nums = 0
    def __init__ (self,name,age,city):
        self.name = name  # 实例属性
        self.age = age
        self.city = city
        Person.nums += 1  # 每次调用构造函数对类属性nums进行+1

    def show(self):
        print(self.name)

class Score(Person):
    def __init__(self,name,age,city,score):
        super().__init__(name,age,city)  # 调用了父类的构造函数
        self.score = score
    # 覆盖父类的show方法
    def show(self):
        print(self.name,self.score)
s1 = Score("zhangsan",20,"shanghai",100)
s1.show()
print(Score.nums)  # 使用父类的类属性nums
